Skip to content

Find proxy payloads through recursive message types - #340

Draft
stephanos wants to merge 8 commits into
mainfrom
fix-recursive-payload-discovery
Draft

stephanos wants to merge 8 commits into
mainfrom
fix-recursive-payload-discovery

Conversation

@stephanos

@stephanos stephanos commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What changed?

Resolve payload reachability through recursive protobuf types before pruning proxy visitors.

Why?

A temporary negative result during a cycle could hide a path to a payload.

How did you test it?

Reproduced the bug with a recursive descriptor. make check passed, and make test now runs the nested proxy generator regression.

Potential risks

The generator can now include additional visitors for recursive message shapes.

Comment thread .gitattributes
# for more info.
*.pb.go linguist-generated
*.mock.go linguist-generated
cmd/proxygenerator/interceptor.go -linguist-generated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub thinks this is a generated file.

return res
}
// Mark this message as not containing a payload to break cycles.
memo[fullName] = false

@stephanos stephanos Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: This temporary false can become a stale result for another type.

If A visits B and B points back to A, B stays cached as having no payload even after A finds one.

}

// If we've walked this type before, return the previous result
if record, ok := (*records)[typeName]; ok {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A record is inserted before its getters are fully scanned. A recursive getter can read Matches == false from that unfinished record and get skipped, even if the target type later turns out to contain a payload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant